<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\LoginController;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\Api\AuthController;
use App\Http\Controllers\Api\CardController;
use App\Http\Controllers\ProductController;
use App\Http\Controllers\Api\SuningController;
use App\Http\Controllers\Api\HelloController;
use App\Http\Controllers\MyController;


Route::get('/', [HomeController::class, 'welcome'])->name('home');
Route::get('/get_sms_code', [HomeController::class, 'getSmsCode']);
Route::get('/products', [ProductController::class, 'index']);
Route::get('/suning', [ProductController::class, 'suning']);
Route::get('/suning/lb', [ProductController::class, 'suning']);

Route::get('/household', [ProductController::class, 'household']);
Route::get('/laundry', [ProductController::class, 'laundry']);
Route::get('/clean', [ProductController::class, 'clean']);
Route::get('/disinfect', [ProductController::class, 'disinfect']);
Route::get('/product/info', [ProductController::class, 'info']);


Route::group(['prefix' => 'my'], function () {
    Route::middleware(['auth:sanctum', 'verified'])->get('/index', [MyController::class, 'index']);
    Route::middleware(['auth:sanctum', 'verified'])->get('/orders', [MyController::class, 'orders']);
    Route::middleware(['auth:sanctum', 'verified'])->get('/coupons', [MyController::class, 'coupons']);

    Route::middleware(['auth:sanctum', 'verified'])->get('/order_info', [MyController::class, 'orderInfo']);
    Route::middleware(['auth:sanctum', 'verified'])->get('/order_cancel', [MyController::class, 'orderCancel']);
    Route::middleware(['auth:sanctum', 'verified'])->post('/order_cancel', [MyController::class, 'postOrderCancel']);
    Route::middleware(['auth:sanctum', 'verified'])->get('/coupon_order_create', [MyController::class, 'couponOrderCreate']);
    Route::middleware(['auth:sanctum', 'verified'])->post('/coupon_order_save', [MyController::class, 'couponOrderSave']);
});

// Route::middleware(['auth:sanctum', 'verified'])->get('/my/orders', [MMyController::class, 'orders']);
// Route::middleware(['auth:sanctum', 'verified'])->get('/my/reserve', [MMyController::class, 'reserve']);
// Route::middleware(['auth:sanctum', 'verified'])->post('/my/post_reserve', [MMyController::class, 'postReserve']);
// Route::middleware(['auth:sanctum', 'verified'])->get('/dashboard', [HomeController::class, 'dashboard'])->name('dashboard');

Route::get('/login', [LoginController::class, 'getLoginPhone'])->name('login');
Route::post('/login_captcha', [LoginController::class, 'postCaptcha']);
Route::post('/login', [LoginController::class, 'postLoginPhone'])->name('login_post');

// API 接口
Route::group(['prefix' => 'api'], function () {

    // 联通沃支付接口
    Route::get('/iptv_card/{bn}/GetAccessToken', [AuthController::class, 'getAccessToken'])->name('getAccessToken')->where('bn', '[A-Za-z0-9]+');
    Route::get('/iptv_card/{bn}/TestSign', [AuthController::class, 'testSign'])->where('bn', '[A-Za-z0-9]+');
    Route::get('/iptv_card/{bn}/RefreshToken', [AuthController::class, 'refreshToken'])->where('bn', '[A-Za-z0-9]+');
    Route::get('/iptv_card/{bn}/GetCard', [CardController::class, 'getCard'])->where('bn', '[A-Za-z0-9]+');
    Route::get('/iptv_card/{bn}/ReverseOrder', [CardController::class, 'reverseOrder'])->where('bn', '[A-Za-z0-9]+');
    Route::get('/iptv_card/{bn}/GetPwd', [CardController::class, 'getPwd'])->where('bn', '[A-Za-z0-9]+');

    // 苏宁帮客回调接口
    Route::get('/suning', [SuningController::class, 'tip']);
    Route::post('/suning', [SuningController::class, 'index']);
    Route::get('/suning/test', [SuningController::class, 'test']);

    Route::get('/hello', [HelloController::class, 'hello']);
    Route::get('/iptv/ad/boot', [HelloController::class, 'IptvAdBoot']);
});


